<?php
/**
 * 匠言知识付费
 * Author: 山西匠言网络科技有限公司
 * This is not a free software, it under the license terms, you can visit https://www.zsffzxkc.cn/ get more details.
 */
namespace app\index\controller;
use app\index\controller\Base;
use think\Controller;
use think\Db;
class Notice extends  Base
{
    public function newnotice(){
        $map=array(
          'acid'=>1,
        );
        $data=Db::name('gonggao')
            ->where($map)
            ->order('addtime desc')
            ->select();
        foreach ($data as $k=>$v){
            $data[$k]['addtime'] = date('Y-m-d H:i:s',$v['addtime']);
        }
        $this->result(0,'获取通知数据成功',$data,0,'json');
    }
    /*
 * 获取详细通知
 * */
    public function detail(){
        $post = input('post.');
        $map=array(
            'acid'=>1,
        );
        $data=Db::name('gonggao')
            ->where($map)
            ->where('id',$post['id'])
            ->find();
        if(!empty($data)){
            $data['addtime'] = date('Y-m-d H:i:s',$data['addtime']);
            $this->result(0,'获取通知数据成功',$data,0,'json');
        }else{
            $this->result(1,'获取通知数据失败','',0,'json');
        }
    }
}
